package com.ap.core.validation.message.rules;

import java.math.BigDecimal;

import com.ap.core.domain.Amount;
import com.ap.core.message.managertp.info.SubmitRTPMessageInfo;
import com.ap.core.validation.message.info.MessageValidationInfo;
import com.ap.core.validation.message.info.OriginalInfo;
import com.ap.core.validation.rules.AbstractValidationRule;

/**
 * User: Ranjit.Singh
 * Check if the Total Payment Request Amount is zero or negative
 */
public class SF0001Rule extends AbstractValidationRule<MessageValidationInfo<SubmitRTPMessageInfo,OriginalInfo>> {
					    


    @Override
    public boolean validate(MessageValidationInfo<SubmitRTPMessageInfo,OriginalInfo> infoObject) {
       final BigDecimal totalPaymentRequestAmount = infoObject.getBoundObject().getRTPSummary().getPaymtAmtInfo().getTotalPaymentReqAmount();
        return Amount.valueOf(totalPaymentRequestAmount).isGreaterThan(Amount.valueOf(BigDecimal.ZERO));
    }

    

}








